/**
 * PatientDAO.java
 *
 * author: Daniel Rudigier
 * date: 28.4.2008
 * project: ocumed
 * 
 * Interfaces:
 *  PatientDAO
 */
package ocumed.persistenz.dao;

import java.util.List;

import ocumed.persistenz.hibernate.OcPatient;

/**
 * DAO interface for OcPatient
 */
public interface PatientDAO extends DAOUserTransaction {
    /**
     * Table mapping
     */
    public static final char geschlechtWeiblich = 'w';
    /**
     * Table mapping
     */
    public static final char geschlechtMaennlich = 'm';
    
    /**
     * Table mapping
     */
    public static final char besitztEcard = '1';
    /**
     * Table mapping
     */
    public static final char besitztKeineEcard = '0';
    
    /**
     * Table mapping
     */
    public static final char typErfasst = 'e';
    /**
     * Table mapping
     */
    public static final char typArchiviert = 'a';

    /**
     * persist a object, and return the generated id
     *
     * @param transientInstance
     * @return the generated id
     */
    public Integer persist(OcPatient transientInstance);

    /**
     * save or update object.
     *
     * @param instance
     */
    public void attachDirty(OcPatient instance);

    /**
     * has to do with locking.
     * 
     * @param instance
     */
    public void attachClean(OcPatient instance);

    /**
     * delete an instance.
     * 
     * @param persistentInstance
     */
    public void delete(OcPatient persistentInstance);

    /**
     * merge instances 
     *
     * @param detachedInstance
     * @return
     */
    public OcPatient merge(OcPatient detachedInstance);

    /**
     * find by primary key.
     *
     * @param id
     * @return
     */
    public OcPatient findById(int id);
    
    /**
     * find all entries.
     *
     * @return
     */
    public List<OcPatient> findAll();

    /**
     * find all patients by name, case-insensitive
     * 
     * @param criteria
     * @return
     */
    public List<OcPatient> findByName(String criteria);
    
    /**
     * find all patients by versNr
     * 
     * @param versNr
     * @return returns a instance or null
     */
    public OcPatient findByVersNr(String versNr);
}